﻿<div id="grid_ebmi" style="text-align: center"></div>
<div style="color:red; padding:10px">
    注：体重指数（BMI）=体重（千克）/身高（米）的平方
</div>
<script>
    $(function () {
        $("#grid_ebmi").kendoGrid({
            columns: [{
                title: "性别",
                field: "Sex",
                template: "#=GetSexString(Sex)#",
                width: 80
            }, {
                title: "体重指数",
                field: "Max",
                template: "#=GetBmi(Min,Max)#",
                width: 120
            }, {
                title: "得分",
                field: "Score",
                width: 80
            }, {
                title: "等级",
                field: "Level",
                width: 120
            }, {}],
            dataSource: Whale.dataSource({
                url: "/Standard/Evaluation/GetEBMI",
                getParameters: function () {
                    return {
                        gradeCode: "@ViewBag.GradeCode"
                    }
                }
            }),
            dataBound: function (e) {
                //让表头居中
                $("th.k-header").attr("style", "text-align:center; font-weight:bold;");
            }
        });
    });

    function GetBmi(min, max) {
        if (min == 0)
            return "<=" + max;
        else if (max == 1000)
            return ">=" + min;
        else
            return min + "~" + max;
    }
</script>